Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Share extension Android and iOS implementation #54354

Draft
wants to merge 144 commits into
base: main
Choose a base branch
from

Conversation

Guccio163
Copy link
Contributor

@Guccio163 Guccio163 commented Dec 19, 2024

Details

This PR introduces the implementation of Share Extension for mobile apps both for Android and iOS.

Fixed Issues

$#48788
$#48789
PROPOSAL:

Tests

Share test:

  1. Choose a text/file to share from gallery/file manager on device
  2. Select 'Expensify' as the target application to share to
  3. Choose 'Share' tab
  4. Choose a recipient/workspace to share to
  5. Check if 'Share Details' page displays correctly, specifically attachment's section -
    • no attachment if you shared text
    • file's thumbnail if you shared image/video
    • rectangle with file's name and paperclip icon in the rest of the cases
  6. Check if clicking in image/video thumbnail opens full-size modal with image/video
  7. Enter message
  8. Select 'Share'
  9. Check if shared content was shared successfully (added to chat with recipient or new chat was created)

Submit test:

  1. Choose a file to share from gallery/file manager on device
  2. Select 'Expensify' as the target application to share to
  3. Choose 'Submit' tab (should be available)
  4. Choose a recipient/workspace to share to
  5. Check if 'Submit Details' page displays correctly, specifically attachment's section with file's thumbnail
  6. Add description and save it
  7. Select 'Submit'
  8. Check if shared content was submitted successfully (added to chat with recipient or new chat was created)
  • Verify that no errors appear in the JS console

Offline tests

N/A

QA Steps

N/A

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native

Share:
https://github.com/user-attachments/assets/c02605d4-b7d3-448e-8797-0f32ca98381a

Submit:
https://github.com/user-attachments/assets/bbee5791-6c04-49f3-b551-609ecf0b5b1f

Android: mWeb Chrome

N/A

iOS: Native

Share:
https://github.com/user-attachments/assets/119da39e-323f-4cd2-a39a-94fe5ac3dc42

Submit:
https://github.com/user-attachments/assets/671eb9d0-7275-4470-bcad-50a50e1cd53a

iOS: mWeb Safari

N/A

MacOS: Chrome / Safari

N/A

MacOS: Desktop

N/A

BrtqKr and others added 30 commits August 28, 2024 13:19
@grgia
Copy link
Contributor

grgia commented Jan 14, 2025

@Guccio163 could you resolve any addressed comments?

@grgia
Copy link
Contributor

grgia commented Jan 14, 2025

@Guccio163 given the updates, could you also give a quick update on where you're at and what's blocking you

@Guccio163
Copy link
Contributor Author

Sure, I'll resolve all that doesn't need further analysis; Right now I'm handling couple of last comments that are far trickier to implement in a proposed way with @filip-solecki, moreover yesterday and tomorrow morning I had quite big problems with handling simulator problems due to merged main, but it's OK on iOS right now, hopefully we'll be done with it shortly 😄

@Guccio163
Copy link
Contributor Author

Hi, I resolved all the comments that have their changes implemented, the couple that are left are connected to createOption dive and migration to just report variable with useOnyx's selector, I also left unresolved the one comment explaining differences between AttachmentView and AttachmentPreview; looking forward to wrapping it soon!

@Guccio163
Copy link
Contributor Author

@grgia I'm working shorter hours tomorrow, so I'm letting you know that I already recorded and uploaded videos of iOS native; after clean build of android I encountered a bug with sending the media, we'll work with @filip-solecki to wrap it up :D

Also could you tag one of Designers to take a peek if it looks ok? Then only android recording would stand between us and completing the checklist.

@filip-solecki
Copy link
Contributor

Hi @grgia , everything is complete on our side. We're just waiting for the provisioning profile to be added, and then it will be fully ready for the testing session.

@Guccio163 will be adding the Android videos shortly.

@Guccio163
Copy link
Contributor Author

Hi @grgia, @filip-solecki merged main including some named-imports and I successfully captured and added android recordings - PR creator checklist is complete, so we're waiting for your provisioning profile and a green light for a Ready for review.

I have an additional question, namely are we considering adding more supported file types to share-extension? There are some types that are supported by sharing attachments in-app (f.ex. video/quicktime present on iOS devices), but not on our target supported list - from what I've tried they work just fine. Moreover Submit in-app supports more than just images (f.ex. PDFs) and we don't take PDFs into consideration right now; maybe there are more types like that? If so, should we work over finding them all, or are we prioritising finishing PR ale thinking about expanding the list afterwards?

@grgia
Copy link
Contributor

grgia commented Jan 21, 2025

so we're waiting for your provisioning profile

I created an issue to track this here: #55539

I was OOO the last few days, but I fixed my profile so I'll see if i can get this working now

@grgia
Copy link
Contributor

grgia commented Jan 22, 2025

I have an additional question, namely are we considering adding more supported file types to share-extension? There are some types that are supported by sharing attachments in-app (f.ex. video/quicktime present on iOS devices), but not on our target supported list - from what I've tried they work just fine. Moreover Submit in-app supports more than just images (f.ex. PDFs) and we don't take PDFs into consideration right now; maybe there are more types like that? If so, should we work over finding them all, or are we prioritising finishing PR ale thinking about expanding the list afterwards?

@Guccio163 we ideally should support sharing all supported file types, but we could handle this in a follow up. Do we currently handle errors from unsupported types? Do you have a list of what types we do and don't support

@grgia
Copy link
Contributor

grgia commented Jan 22, 2025

@Guccio163 could you fix conflicts so I can try and add the provisioning profile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants